import request from "@/utils/request";

/**
 * 保存演练计划内容接口
 * @param {*} data
 * @returns
 */
export function editDrillPlan(data) {
    return request({
        url: "/drill/plan",
        method: data.planId == 0 ? "post" : "put",
        data: data,
    });
}

/**
 * 删除演练计划接口
 * @param {*} data
 * @returns
 */
export function delDrillPlan(planId) {
    return request({
        url: "/drill/plan/" + planId,
        method: "delete",
    });
}

/**
 * 保存预案响应级别内容接口
 * @param {*} data
 * @returns
 */
export function editResponseLevel(data) {
    return request({
        url: "/pla/level",
        method: "put",
        data: data,
    });
}

/**
 * 编辑预案流程环节接口
 * @param {*} data
 * @returns
 */
export function editPlanHandle(data) {
    return request({
        url: "/pla/handle",
        method: data.handleId == 0 ? "post" : "put",
        data: data,
    });
}

/**
 * 删除预案流程环节接口
 * @param {*} handleId
 * @returns
 */
export function delPlanHandle(handleId) {
    return request({
        url: "/pla/handle/" + handleId,
        method: "delete",
    });
}

/**
 * 修改流程响应级别内容接口
 * @param {*} data
 * @returns
 */
export function editHandleLevel(data) {
    return request({
        url: "/pla/HandleLevel",
        method: "put",
        data: data,
    });
}

/**
 * 批量新增流程环节的响应级别数据
 * @param {*} data
 * @returns
 */
export function batchAddHandleLevels(data) {
    return request({
        url: "/pla/HandleLevel",
        method: "post",
        data: data,
    });
}

/**
 * 修改流程任务卡接口
 * @param {*} data
 * @returns
 */
export function editHandleTask(data) {
    return request({
        url: "/pla/task",
        method: data.taskId == 0 ? "post" : "put",
        data: data,
    });
}

/**
 * 删除流程任务卡接口
 * @param {*} taskId
 * @returns
 */
export function delHandleTask(taskId) {
    return request({
        url: "/pla/task/" + taskId,
        method: "delete",
    });
}

/**
 * 获取演练计划内容详情接口
 * @param {*} planId
 * @returns
 */
export function getDrillPlanInfo(planId) {
    return request({
        url: "/drill/content/" + planId,
        method: "get",
    });
}

/**
 * 获取演练计划列表接口
 * @param {*} query
 * @returns
 */
export function getDrillPlanList(userId, query) {
    return request({
        url: "/drill/plan/list/" + userId,
        method: "get",
        params: query,
    });
}

/**
 * 获取演练计划审批列表接口
 * @param {*} planId
 * @returns
 */
export function getApprovePlanList(userId, query) {
    return request({
        url: "/drill/plan/list/approve/" + userId,
        method: "get",
        params: query,
    });
}

/**
 * 演练计划发布列表接口
 * @param {*} userId
 * @returns
 */
export function getPublishPlanList(userId, query) {
    return request({
        url: "/drill/plan/list/publish/" + userId,
        method: "get",
        params: query,
    });
}

/**
 * 保存演练计划事件内容接口
 * @param {*} data
 * @returns
 */
export function editDrillEventInfo(data) {
    return request({
        url: "/drill/content",
        method: "put",
        data: data,
    });
}

/**
 * 演练计划角色分组添加
 * @param {*} data
 * @returns
 */
export function editDrillRoleGroup(data) {
    return request({
        url: "/drill/group",
        method: data.groupId == 0 ? "post" : "put",
        data: data,
    });
}

/**
 * 删除演练计划角色分组
 * @param {*} data
 * @returns
 */
export function delDrillRoleGroup(groupId) {
    return request({
        url: "/drill/group/" + groupId,
        method: "delete",
    });
}

/**
 * 演练计划参演角色添加接口
 * @param {*} data
 * @returns
 */
export function drillRoleAdd(data) {
    return request({
        url: "/drill/dept",
        method: "post",
        data: data,
    });
}

/**
 * 修改演练计划参演角色虚拟状态接口
 * @param {*} data
 * @returns
 */
export function setDrillRoleFlag(data) {
    return request({
        url: "/drill/dept",
        method: "put",
        data: data,
    });
}

/**
 * 移除演练计划参演角色接口
 * @param {*} groupId
 * @returns
 */
export function delDrillRole(roleId) {
    return request({
        url: "/drill/dept/" + roleId,
        method: "delete",
    });
}

/**
 * 编辑演练计划突发情景接口
 * @param {*} data
 * @returns
 */
export function editSuddenScene(data) {
    return request({
        url: "/drill/scene",
        method: data.sceneId == 0 ? "post" : "put",
        data: data,
    });
}

/**
 * 演练计划突发情景删除接口
 * @param {*} data
 * @returns
 */
export function delSuddenScene(sceneId) {
    return request({
        url: "/drill/scene/" + sceneId,
        method: "delete",
    });
}

/**
 * 修改演练计划预案响应级别
 * @param {*} data
 * @returns
 */
export function setDrillResponseLevel(data) {
    return request({
        url: "/drill/content/chooseResponseLevel",
        method: "post",
        data: data,
    });
}

/**
 * 删除演练计划指派的任务接口
 * @param {*} roleId
 * @returns
 */
export function delDrillTask(taskId) {
    return request({
        url: "/hd/task/" + taskId,
        method: "delete",
    });
}

/**
 * 修改演练计划流程检查内容
 * @param {*} data
 * @returns
 */
export function setDrillHandleCheckContent(data) {
    return request({
        url: "/drill/handleLevel",
        method: "put",
        data: data,
    });
}

/**
 * 演练计划突发情景附件添加接口
 * @param {*} data
 * @returns
 */
export function drillSceneAttachAdd(data) {
    return request({
        url: "/drill/sceneAttach",
        method: "post",
        data: data,
    });
}

/**
 * 删除演练计划突发情景附件
 * @param {*} taskId
 * @returns
 */
export function delDrillSceneAttach(attachId) {
    return request({
        url: "/drill/sceneAttach/" + attachId,
        method: "delete",
    });
}

export function delDrillSceneAttachByAttachId(attachId, senceId) {
    return request({
        url: "/drill/sceneAttach/removeByAttachId/" + attachId + "/" + senceId,
        method: "delete",
    });
}

/**
 * 开始执行演练计划接口
 * @param {*} data
 * @returns
 */
export function startDrillPlan(planId) {
    return request({
        url: "/drill/plan/startContent/" + planId,
        method: "post",
    });
}

/**
 * 开启演练计划流程接口
 * @param {*} handleId
 * @returns
 */
export function startDrillFlow(handleId) {
    return request({
        url: "/drill/handle/startDrillHandle/" + handleId,
        method: "put",
    });
}

/**
 * 开启演练突发情景
 * @param {*} sceneId
 * @returns
 */
export function startDrillScene(sceneId) {
    return request({
        url: "/drill/scene/startScene/" + sceneId,
        method: "put",
    });
}

/**
 * 获取虚拟角色任务
 * @param {*} query
 * @returns
 */
export function getVirsualTasks(planId) {
    return request({
        url: "/drill/dept/selectAITasks/" + planId,
        method: "get",
    });
}

/**
 * 获取演练计划参演角色人员数据
 * @param {*} handleId
 * @returns
 */
export function getDrillGroupRole(handleId) {
    return request({
        url: "/drill/dept/selectByTaskId/" + handleId,
        method: "get",
    });
}

/**
 * 获取演练计划日志
 * @param {*} taskId
 * @returns
 */
export function getDrillLogs(query) {
    return request({
        url: "/drill/log/selectLogsByPlanId",
        method: "get",
        params: query,
    });
}

/**
 * 获取演练任务列表
 * @param {*} handleId
 * @returns
 */
export function getDrillTasks(handleId) {
    return request({
        url: "/hd/task/selectTasksByHandleId/" + handleId,
        method: "get",
    });
}

/**
 * 根据HandleId获取PlanId
 * @param {*} handleId
 * @returns
 */
export function getHandleIdByPlanId(planId) {
    return request({
        url: "/drill/plan/queryHandleIdByPlanId/" + planId,
        method: "get",
    });
}

/**
 * 查询二级子任务列表
 * @param {*} params
 * @returns
 */
export function getDrillSonTaskList(taskId) {
    return request({
        url: "/hd/task/selectTasksByTaskId/" + taskId,
        method: "get",
    });
}

/**
 * 提交任务接口
 * @param {*} data
 * @returns
 */
export function handleSubmitTask(data) {
    return request({
        url: "/hd/submitTask",
        method: "post",
        data: data,
    });
}

/**
 * 结束应急演练接口
 * @param {*} planId
 * @returns
 */
export function closePlan(planId) {
    return request({
        url: "/drill/plan/closePlan/" + planId,
        method: "put",
    });
}

// 获取演练统计数据
export function getDrillStatistics(query) {
    return request({
        url: "/drill/plan/getDrillStatistics",
        method: "get",
        params: query,
    });
}

// 提交演练审核
export function submitDrillPlanApprove(planId, data) {
    return request({
        url: "/drill/plan/approve/submit/" + planId,
        method: "put",
        data,
    });
}

// 批量提交演练审核
export function submitBatchDrillPlanApprove(data) {
    return request({
        url: "/drill/plan/approve/batchSubmit",
        method: "put",
        data,
    });
}

// 演练审核
export function approveDrillPlan(planId, data) {
    return request({
        url: "/drill/plan/approve/apply/" + planId,
        method: "put",
        data,
    });
}

// 批量演练审核
export function approveBatchDrillPlan(data) {
    return request({
        url: "/drill/plan/approve/batchApply",
        method: "put",
        data,
    });
}

// 演练发布
export function publishDrillPlan(planId, data) {
    return request({
        url: "/drill/plan/approve/publish/" + planId,
        method: "put",
        data,
    });
}

// 批量演练发布
export function publishBatchDrillPlan(data) {
    return request({
        url: "/drill/plan/approve/batchPublish",
        method: "put",
        data,
    });
}

// 获取所有已结束的演练计划列表
export function getEndDrillPlanList(query) {
    return request({
        url: "/drill/plan/getEndedDrillPlans",
        method: "get",
        params: query,
    });
}

// 保存演练流程总结内容
export function saveDrillHandleReport(handleId, data) {
    return request({
        url: "/drill/handle/saveReport/" + handleId,
        method: "put",
        data,
    });
}

// 提交总结报告
export function submitDrillPlanReport(planId, data) {
    return request({
        url: "/drill/plan/submitReport/" + planId,
        method: "put",
        data,
    });
}

// 获取总结附件列表
export function getDrillPlanReportAttachs(planId) {
    return request({
        url: "/drill/plan/getReportAttachList/" + planId,
        method: "get",
    });
}
